#include <QCoreApplication>
#include "Link.h"

int main(int argc, char *argv[])
{
    QCoreApplication a(argc, argv);

    //初始化SDK
    Link::init();

    //创建视频输入模块
    LinkObject *vi=Link::create("InputVi");
    QVariantMap dataVi;
    dataVi["interface"]=Link::getConfig()["interfaceV"].toMap().firstKey();;
    vi->start(dataVi);

    //创建视频裁剪模块
    LinkObject *crop=Link::create("Crop");
    QVariantMap dataCrop;
    //浮点坐标模式
    dataCrop["x"]=0.2;
    dataCrop["y"]=0.2;
    dataCrop["width"]=0.5;
    dataCrop["height"]=0.5;
    //像素裁边模式(两种模式二选一)
    //dataCrop["L"]=64;
    //dataCrop["T"]=64;
    //dataCrop["R"]=64;
    //dataCrop["B"]=64;
    crop->start(dataCrop);

    //创建视频输出模块
    LinkObject *vo=Link::create("OutputVo");
    QVariantMap dataVo;
    dataVo["type"]="hdmi";
    vo->start(dataVo);

    //连接数据流(视频采集->裁剪->显示)
    vi->linkV(crop)->linkV(vo);

    return a.exec();
}

